<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <body>

        <ui:composition template="./template.xhtml">

            <ui:define name="title">
                Kuchařka - #{receptView.recept.nazev}
            </ui:define>

            <ui:define name="heading">
                #{receptView.recept.nazev}
            </ui:define>

            <ui:define name="subheading">
                Interaktivní průvodce Vás provede vařením vybraného receptu.
            </ui:define>

            <ui:define name="content">
                <table width="100%">
                    <tr>
                        <td align="left">
                            <h3>
                                Seznam ingrediencí
                            </h3>
                        </td>
                    </tr>
                </table>
                 
                <ul>
                    <ui:repeat value="#{receptView.toList(receptView.recept.seznamIngredienci)}" var="entry">
			<li>
                            <h:outputText escape="false" value="#{entry.value.mnozstvi}"/>
                            &nbsp;
                            <h:outputText escape="false" value="#{entry.value.jednotka}"/>
                            &nbsp;-&nbsp;
                            <h:outputText escape="false" value="#{entry.key.nazev}"/>
			</li>
                    </ui:repeat>	
		</ul>
        
		<h3>
	  		Postup
		</h3>
                    <h:outputText escape="false" value="#{receptView.recept.postup}"/>
                     <h:form>
                        <c:choose>
                            <c:when test="#{PrihlaseniView.logged}">
                                <h:commandLink type="submit" class="btn btn-xs btn-primary" action="#{receptView.showReceptEdit(receptView.recept)}">
                                    <span class="glyphicon glyphicon-triangle-right"/>Další krok
                                </h:commandLink>
                            </c:when>
                            <c:otherwise>
                                <b>Gratulujeme! Dokončili jste vaření receptu. Nyní jej můžete ohodnotit.</b>
                                <br/>
                                Hodnocení: 
                                <h:selectOneRadio value="#{ReceptView.rating}">
                                    <f:selectItem itemValue="1" itemLabel="1"/>
                                    <f:selectItem itemValue="2" itemLabel="2" />
                                    <f:selectItem itemValue="3" itemLabel="3" />
                                    <f:selectItem itemValue="4" itemLabel="4" />
                                    <f:selectItem itemValue="5" itemLabel="5" />
                                </h:selectOneRadio>
                                
                                <h:inputText class="form-control" id="komentar" maxlength="10" required="" style="width:30%; height:55px; max-width:100%; margin-top:10px" p:placeholder="Komentář (nepovinné)"/>
                                <h:commandLink type="submit" class="btn btn-xs btn-success" style="margin-top:10px">
                                    <span class="glyphicon glyphicon-arrow-right"></span>Odeslat hodnocení
                                </h:commandLink>
                            </c:otherwise>
                        </c:choose>
                    </h:form>
                <!--<ul>
                    <ui:repeat value="#{receptView.recept.postup}" var="value">
                                <li>
                                    <h:outputText escape="false" value="#{value.postup}"/>
                                </li>
                    </ui:repeat>
                </ul>-->  
                
		
            </ui:define>
            
            <ui:define name="breadcrumbs">
                <h:commandLink action="index" value="Kuchařka"/> > <h:commandLink action="recepty" value="Seznam receptů"/> > <h:commandLink action="#{receptView.showReceptDetail(recept)}" value="#{receptView.recept.nazev}"/> > Vaření
            </ui:define>

        </ui:composition>

    </body>
</html>
